/*
* @Author: dengjiayao
* @Date:   2017-04-10 14:57:41
 * @Last Modified by: songwh
 * @Last Modified time: 2017-05-05 09:55:27
*/

import { modal } from 'vue-strap'
import { showMsg, answerSearchNoresult } from '../../vuex/action'

export default {
  name: 'ai-guide-config',
  components: {
    'vue-modal': modal
  },
  vuex: {
    actions: {
      xShowMsg: showMsg,
      xAnswerSearchNoresult: answerSearchNoresult
    }
  },
  props: ['showAnswer', 'it'],
  data() {
    return {
    }
  },
  computed: {
  },
  ready() {
  },
  methods: {
    submit() {
      if (!this.it.qid){
        return this.xShowMsg({
          type: 'danger',
          content: '* 标记的为必填项'
        })
      }
      var params = {
        id: this.it.id,
        qid: this.it.qid,
        customerId: this.it.customerId
      }
      this.xAnswerSearchNoresult(params)
        .then((data) => {
          this.showAnswer= false
          this.xShowMsg({
            type: 'danger',
            content: '操作成功！'
          })
        })
        .catch((res) => {
          this.xShowMsg({
            type: 'danger',
            content: res.error_msg
          })
        })
    }
  }
}
